import React from 'react';
import CommonPage from '@/components/page/CommonPage';
import { renderNumber } from '@/utils/common';

const daoName = 'JYDWLSZS';
const importName = 'JYDWLSZS';
const columns: API.Column[] = [
  {
    title: '导入日期',
    width: 120,
    sorter: true,
    key: 'NY',
    dataIndex: 'NY',
    dispaly: true,
    filter: true,
    export: false,
  },
  {
    title: '经营单位',
    width: 120,
    sorter: true,
    dataIndex: 'JYDW',
    key: 'JYDW',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '信用卡净收入',
    width: 160,
    sorter: true,
    key: 'XYK',
    dataIndex: 'XYK',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '保险',
    width: 160,
    sorter: true,
    key: 'BX',
    dataIndex: 'BX',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '理财',
    width: 160,
    sorter: true,
    key: 'LC',
    dataIndex: 'LC',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '基金',
    width: 160,
    sorter: true,
    key: 'JJ',
    dataIndex: 'JJ',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '贵金属',
    width: 160,
    sorter: true,
    key: 'GJS',
    dataIndex: 'GJS',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '保管箱',
    width: 160,
    sorter: true,
    key: 'BGX',
    dataIndex: 'BGX',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '私行代销',
    width: 160,
    sorter: true,
    key: 'SHDX',
    dataIndex: 'SHDX',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '其他',
    width: 160,
    sorter: true,
    key: 'QT',
    dataIndex: 'QT',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
];
const controls: API.Control[] = [
  {
    name: 'NY',
    rules: [
      { required: true, message: '按YYYYMM格式输入,例如:202201' },
      { min: 6, max: 6, message: '长度不能小于6，大于6' },
    ],
    type: 'text',
    label: '日期',
    grid: 12 / 24,
  },
  {
    name: 'JYDW',
    rules: [{ required: true, message: '不能为空' }],
    type: 'text',
    label: '经营单位',
    grid: 12 / 24,
  },
  {
    name: 'XYK',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '信用卡净收入',
    grid: 12 / 24,
  },
  {
    name: 'BX',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '保险',
    grid: 12 / 24,
  },
  {
    name: 'LC',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '理财',
    grid: 12 / 24,
  },
  {
    name: 'JJ',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '基金',
    grid: 12 / 24,
  },
  {
    name: 'GJS',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '贵金属',
    grid: 12 / 24,
  },
  {
    name: 'BGX',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '保管箱',
    grid: 12 / 24,
  },
  {
    name: 'SHDX',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '私行代销',
    grid: 12 / 24,
  },
  {
    name: 'QT',
    rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '其他',
    grid: 12 / 24,
  },
];

const jydwlszsForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="经营单位零售中收"
      importName={importName}
      importControls={controls}
      importMode="DeleteAfterInsert"
      importParamNames={['NY']}
      importTemplateName="经营单位零售中收导入"
      initSorter={{ FieldName: 'NY', Direction: 'DESC' }}
    />
  );
};

export default jydwlszsForm;
